---
category: String
created: '2020-05-12'
title: 'Convert snake_case to camelCase'
updated: '2021-10-13'
---

**JavaScript version**

```js snakeToCamel.js
const snakeToCamel = (str) => str.toLowerCase().replace(/(_\w)/g, (m) => m.toUpperCase().substr(1));
```

**TypeScript version**

```ts snakeToCamel.ts
const snakeToCamel = (str: string): string => str.toLowerCase().replace(/(_\w)/g, (m) => m.toUpperCase().substr(1));
```

**Examples**

```js examples.js
snakeToCamel('HELLO_world'); // 'helloWorld'
```
